package com.qijia.common.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.ManyToMany;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;

/**
 * AbstractCommonUsers entity provides the base persistence definition of the
 * CommonUsers entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractCommonUsers extends BaseData implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 2239136392462046298L;
	private Integer CUId;
	private Integer enable;
	private String password;
	private String username;
	private Integer userType;
	private Set<UserRole> userRole = new HashSet<UserRole>(0);

	// Constructors

	/** default constructor */
	public AbstractCommonUsers() {
	}

	/** full constructor */
	public AbstractCommonUsers(Integer enable, String password,
			String username, Set<UserRole> userRole) {
		this.enable = enable;
		this.password = password;
		this.username = username;
		this.userRole = userRole;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "c_u_id", unique = true, nullable = false)
	public Integer getCUId() {
		return this.CUId;
	}

	public void setCUId(Integer CUId) {
		this.CUId = CUId;
	}

	@Column(name = "enable")
	public Integer getEnable() {
		return this.enable;
	}

	public void setEnable(Integer enable) {
		this.enable = enable;
	}

	@Column(name = "password")
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "username")
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	public void setUserType(Integer userType) {
		this.userType = userType;
	}

	@Column(name = "userType")
	public Integer getUserType() {
		return userType;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "users" )
	public Set<UserRole> getUserRole() {
		return this.userRole;
	}

	public void setUserRole(Set<UserRole> userRole) {
		this.userRole = userRole;
	}
}